<template>
  <span title="退出全屏" v-if="screen">
    <icon-fullscreen-exit @click="setScreen('exit')"
  /></span>
  <span title="全屏" v-else>
    <icon-fullscreen @click="setScreen('screen')"
  /></span>
</template>

<script lang="ts" setup>
import { ref } from "vue";

let screen = ref<Boolean>(false);

const setScreen = (val: string) => {
  if (val === "screen") {
    document.documentElement?.requestFullscreen();
    screen.value = true;
    return;
  }
  document?.exitFullscreen();
  screen.value = false;
};
</script>
<style scoped lang="less">
</style>
